package com.beep.erp.model.earlystage.log;

import com.beep.erp.common.bean.EarlyStageListBean;
import com.beep.erp.common.bean.TransferLogBean;
import com.beep.erp.http.HttpExceptionHandle;
import com.beep.erp.http.HttpResultSubscriber;
import com.beep.erp.model.stock.StockContract;
import com.beep.erp.model.transfer.TransferLogListContract;

import rx.schedulers.Schedulers;

/**
 * Created by Jolly on 2018/9/2.
 */

public class StockLogListPresenter extends StockLogListContract.Presenter {
    @Override
    public void getStockLogList(String sign, String timeStamp, int pageSize, int pageNo) {
        mView.showLoading();
        mRxManage.add(mModel.getStockLogList(sign, timeStamp, pageSize, pageNo).unsubscribeOn(Schedulers.io()).subscribe(new HttpResultSubscriber<EarlyStageListBean>() {
            @Override
            public void onError(HttpExceptionHandle.ResponeThrowable e) {
                mView.hideLoading();
                mView.showMessage(e.ErrorInfo);
            }

            @Override
            public void onNext(EarlyStageListBean earlyStageListBean) {
                mView.hideLoading();
                mView.getStockLogList(earlyStageListBean);
            }
        }));
    }

    @Override
    public void onStart() {
        mView.getDate();
    }

}
